<?php defined('_JEXEC') or die('Restricted access'); // no direct access ?>

<?php 
//print_r($items);
jimport( 'joomla.application.application' );
        $db = &JFactory::getDBO();
$q = " SELECT m.id FROM #__menu as m"
	." WHERE m.link = 'index.php?option=com_properties&view=properties' ";	
	$db->setQuery($q);
	$Itemid = $db->loadResult();

$x=0;
$cid = JRequest::getVar('cid', 0, '', 'int');

foreach ($items as $item) { 
$link 		= JRoute::_('index.php?option=com_properties&view=properties&cid='.$item->slug.'&Itemid='.$Itemid);
$x++;
if($cid == $item->id){$current='current active';}else{$current='';}
$clase = 'level1 item'.$x.' '.$current;
if($item->parent==0){
?>
<ul class="menu">
<li class="<?php echo $clase; ?>">
<a class="<?php echo $clase; ?>" href="<?php echo $link; ?>"><span><?php echo $item->name; ?></span></a>
</li>
</ul>
 <?php
 
foreach ($SubItems as $sitem) {
$linkS 		= JRoute::_('index.php?option=com_properties&view=properties&cid='.$sitem->slug.'&Itemid='.$Itemid);
if($sitem->parent==$cid & $sitem->parent==$item->id){
?>
<ul class="menu">
<li class="<?php //echo $clase; ?>">
<a style="margin-left:30px;" class="<?php echo $clase; ?>" href="<?php echo $linkS; ?>"><span><?php echo $sitem->name; ?></span></a>
</li>
</ul>



<?php
 }
 }
 }
 
 } //end foreach items?>


		 


